package cn.iocoder.yudao.module.system.config.a_gaojian;

import com.trs.hybase.client.TRSConnection;
import com.trs.hybase.client.params.ConnectParams;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @author lxj
 */
//@Configuration
@Service
public class ConnectionConfig {

    @Value("${hybase.url}")
    private String urlYaml;
    @Value("${hybase.username}")
    private String usernameYaml;
    @Value("${hybase.password}")
    private String passwordYaml;

    public static String url;
    public static String username;
    public static String password;

    @PostConstruct
    public void getUrl() {
        url = this.urlYaml;
    }

    @PostConstruct
    public void getUserName() {
        username = this.usernameYaml;
    }

    @PostConstruct
    public void getPassWord() {
        password = this.passwordYaml;
    }

//    public static final String url = "http://10.101.221.242:5555";
//    public static final String url = "http://10.101.221.241:5555";
//    public static final String url = "http://168.130.167.19:5555";
//    public static final String username = "admin";
//    public static final String password = "trsadmin";

    @Bean
    public static TRSConnection getTRSConnection() {
        return new TRSConnection(url, username, password, new ConnectParams());
    }
}
